package com.flk.oauth.repository;

import com.flk.oauth.entity.OauthUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author xxwy
 * on 2018/10/15 0015
 */
@Repository
public interface OauthUserRepository extends JpaRepository<OauthUser, Long> {
    OauthUser findByUsername(String username);
    OauthUser findByPhone(String phone);

    @Modifying
    @Query("update OauthUser sc set sc.unblock = false where sc.id= :id")
    void updateUserBolck(@Param(value = "id")long id );

}
